package com.oktest.measure.db.room

import androidx.room.*
import com.oktest.measure.entity.Measure
import com.oktest.measure.entity.Type

/**
 * @Author hhh
 * @Date 2020/10/24
 */
@Dao
interface MeasureDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insert(entity: Measure)

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insert(list: List<Measure>)

    @Query("select * from measure")
    fun queryAll(): List<Measure>

    @Query("select * from measure where id in (:ids)")
    fun queryByIds(ids: List<Long>): List<Measure>

    @Query("select * from measure where id=:id")
    fun load(id: Long): Measure?

    @Query("select * from Type where id=:id")
    fun type(id: Long):Type

    @Update(onConflict = OnConflictStrategy.REPLACE)
    fun update(entity: Measure)

    @Update(onConflict = OnConflictStrategy.REPLACE)
    fun update(list: List<Measure>)
}